import java.util.ArrayList;
import java.util.List;
import java.util.Random;
public class project {

    public static List<Integer> lists = new ArrayList<>();
    public static void main(String[] args) {
        Random random = new Random();
        for (int i = 1; i <= 100; i++) {
            int code = random.nextInt(200)+1;
            if (runnable(code)){
                lists.add(code);
            }else {
                i--;
            }
        }

        System.out.println(lists);
        List<Integer> listsCopy = new ArrayList<>();
        listsCopy.addAll(lists);

        //删除奇数，倒叙删除
        while (lists.size() > 1){
            //1,2,3,4,5,6
            //1,2,3,4,5
            for (int i = lists.size() % 2 == 0 ? lists.size() - 2 : lists.size()-1; i >= 0 ; i -= 2 ) {
                lists.remove(i);
            }
        }
        int index = listsCopy.indexOf(lists.get(0));
        System.out.println(lists);
        System.out.println(index+1);

    }
    public static boolean runnable (int code){
        if (lists.contains(code)){
            return false;
        }else {
            return true;
        }
    }

}
